//index.js

const http = require("../../models/https");

//获取应用实例
const app = getApp()
Page({
  data: {
    value:""
  },
  onLoad: function (options) {
    console.log(options);
    http({
      url:`http://47.113.104.50:3000/playlist/detail?id=${options.id}`,
      success:res=>{
        console.log(res.data.playlist);
        this.setData({
          value:res.data.playlist
        })
      }
    })
  },
  onChange(event){
    var value = this.data.value;
    value.tracks.forEach(res=>{
      if(res.id==event.currentTarget.dataset.id){
        res.state = !res.state;
      }else{
        res.state =false
      }
    })
    this.setData({
      value
    })
  }
})
